package com.pgybook.db.entity.mapper;

import org.springframework.stereotype.Repository;
import com.pgybook.db.entity.domain.OrderComments;
import com.pgybook.db.entity.domain.OrderCommentsEx;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

@Repository
public interface OrderCommentsMapper {
    int countByExample(OrderCommentsEx example);

    int deleteByExample(OrderCommentsEx example);

    @Delete({
            "delete from ordercomments",
            "where ORDERCOMID = #{ordercomid,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long ordercomid);

    @Insert({
            "insert into ordercomments (ORDERID, CRTTYPE, ",
            "CUSTID, STAFFID, ",
            "CRTTIME, CONTENT)",
            "values (#{orderid,jdbcType=BIGINT}, #{crttype,jdbcType=INTEGER}, ",
            "#{custid,jdbcType=BIGINT}, #{staffid,jdbcType=INTEGER}, ",
            "#{crttime,jdbcType=TIMESTAMP}, #{content,jdbcType=VARCHAR})"
    })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "ordercomid", before = false, resultType = Long.class)
    int insert(OrderComments record);

    int insertSelective(OrderComments record);

    List<OrderComments> selectByExample(OrderCommentsEx example);

    @Select({
            "select",
            "ORDERCOMID, ORDERID, CRTTYPE, CUSTID, STAFFID, CRTTIME, CONTENT",
            "from ordercomments",
            "where ORDERCOMID = #{ordercomid,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    OrderComments selectByPrimaryKey(Long ordercomid);

    int updateByExampleSelective(@Param("record") OrderComments record, @Param("example") OrderCommentsEx example);

    int updateByExample(@Param("record") OrderComments record, @Param("example") OrderCommentsEx example);

    int updateByPrimaryKeySelective(OrderComments record);

    @Update({
            "update ordercomments",
            "set ORDERID = #{orderid,jdbcType=BIGINT},",
            "CRTTYPE = #{crttype,jdbcType=INTEGER},",
            "CUSTID = #{custid,jdbcType=BIGINT},",
            "STAFFID = #{staffid,jdbcType=INTEGER},",
            "CRTTIME = #{crttime,jdbcType=TIMESTAMP},",
            "CONTENT = #{content,jdbcType=VARCHAR}",
            "where ORDERCOMID = #{ordercomid,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(OrderComments record);
}
